<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="taglib.jsp" %> 
<%@page import="common.web.action.BaseAction"%>
<%@page import="sysman.SysmanAction"%>
<%
	SysmanAction.checkLogin(request,response);

	String tableName = request.getParameter("tableName");
	String operate = request.getParameter("operate");
	//System.out.println("operate = " + operate + ", tableName = " + tableName);
	if("save".equals(operate)) {//保存
		//request.getRequestDispatcher("/common/commonList.jsp?tableName=" + tableName).forward(request,response);
		BaseAction.doSave(request);
	} else {
		BaseAction.getEntityData(request);
	}
%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>编辑</title>
		<%@ include file="import_common.jsp" %> 
		
		<script type="text/javascript">
			var controller = new BaseController({"contextPath":"${ctx}"});
			if('save' == '<%=operate%>') {
				//alert('保存后返回');
				document.location.href = "commonList.jsp?tableName=<%=tableName%>";
			}
		</script>
	</head>

	<body>
		<div class="show">
			<!-- 工具栏开始 -->
			<div class="tools">
				<div class="fl">
					<a href="javascript:void(controller.doSave('commonEdit.jsp'))" class="btn1">保存</a>
					<a href="javascript:void(history.go(-1))" class="btn1">返回</a>
				</div>
				<div class="clr"></div>
			</div>
			<!-- 工具栏结束 -->
			
			<!-- 数据区开始 -->
			<div class="content1">
				<div class="table_h">
					<div class="tb f14">编辑</div>
				</div>
				
				<!-- form开始 -->
				<form id="editForm" name="editForm" action="commonEdit.jsp" class="form">
					<!-- 隐藏域开始 -->
					<input type="hidden" name="tableName" value="${tableName}" />
					<input type="hidden" name="operate" id="operate" value="" />
					<!-- 隐藏域结束 -->	
					
					<table width="100%" cellspacing="0" cellpadding="0" border="0" class="table_2">
						<thead>
							<c:forEach items="${configList}" var="config" varStatus="status">
								<c:if test="${config.SHOW_TYPE==2 || config.SHOW_TYPE==3}">
								<tr class="tc">
								</c:if>
								
								<c:if test="${config.SHOW_TYPE==0 || config.SHOW_TYPE==1}">
								<tr class="tc" style="display:none">
								</c:if>
								
									<td class="tdEdit">${config.NAME}</td>
									<td align="left">
										<c:if test="${not empty(config.EXPRESSION) }">
											<select name="${config.FIELD_NAME}" id="${config.FIELD_NAME}">
												<option value="">--</option>
												<c:forEach items="${config.OPTIONS}" var="dict"  >
													<option value="${dict.CODE}" ${dict.selected}>${dict.NAME}</option>
												</c:forEach>
											</select>
										</c:if>
										<c:if test="${empty(config.EXPRESSION) }">
											<c:if test="${config.FIELD_LEN>=500 }">
											<textarea rows="5" cols="33" name="${config.FIELD_NAME}" id="${config.FIELD_NAME}">${entity[config.FIELD_NAME]}</textarea>
											</c:if>
											<c:if test="${config.FIELD_LEN<500 }">
											<input name="${config.FIELD_NAME}" id="${config.FIELD_NAME}" value="${entity[config.FIELD_NAME]}" require="true" class="text" maxlength="${config.FIELD_LEN}" size="50" />
											</c:if>
										</c:if>
										<!--  
										<font color=red>*</font>
										-->
									</td>
								</tr>
							</c:forEach>
						</thead>
						<tbody class="tc"></tbody>
					</table>
				</form>
				<!-- form结束 -->
				
			</div>
			<!-- 数据区结束 -->
		</div>
	</body>
	
</html>